//microcommand define 6dice
function shape(reps) {
if (reps.length === 1) return "baozi"
if (reps.length === 2 && +reps[0] - +reps[1] === 111) return "feiji"
if (reps[0].length === 5) return "wutiao"
if (reps.length === 2 && reps[0].length === 3) return "shuangsantiao"
if (reps.length === 3 && +reps[0] - +reps[1] === 11 && +reps[1] - +reps[2] === 11) return "sanliandui"
if (reps.length === 2 && reps[0].length === 4) return "sidaidui"
if (reps.length === 6) return "shunzi"
if (reps.length === 3 && reps[0].length === 2 & reps[1].length === 2) return "sandui"
if (reps[0].length === 4) return "sitiao"
if (reps.length === 3 && reps[0].length === 3) return "sandaidui"
if (reps[0].length === 3) return "santiao"
if (reps.length === 5) return "yidui"
return "liangdui"
}
action(({ session }) => {
let nums = Array.from({ length: 6 }, () => ~~(Math.random() * 6) + 1)
const reps = nums.slice(0).sort((a, b) => b - a).join("").match(/(.)\1*/g).sort((a, b) => b.length - a.length)
const str = reps.join("")
const sh = shape(reps)
return ([h.quote(session.messageId), h("execute", 'nb -v "6 11" ' + nums.map((n, i) => "6:" + (7 - n) + "," + (i * 2 + 1)).join("---")), str, " ", ...h.parse(session.text(".shape." + sh))])
})
locale("zh-CN", { messages: { shape: { baozi: "豹子", feiji: "飞机", wutiao: "五条", shuangsantiao: "双三条", sanliandui: "三连对", sidaidui: "四带对", shunzi: "顺子", sandui: "三对", sitiao: "四条", sandaidui: "三带对", santiao: "三条", yidui: "一对", liangdui: "两对" } } })